

local damage_cooldowns = {}
minetest.register_globalstep(function(dtime)
		for name, cd in pairs(damage_cooldowns)
		do
			cd = cd - dtime
			if cd <= 0
			then
				damage_cooldowns[name] = nil
			else
				damage_cooldowns[name] = cd
			end

		end
	end)

minetest.register_on_player_hpchange(function(player, change, reason)
		if reason.type == "punch"
		then
			local name = player:get_player_name()
			if damage_cooldowns[name]
			then
				return 0
			else
				damage_cooldowns[name] = 0.1
				return change
			end
		elseif reason.type == "fall"
		then
			return 0
		end
		return change
	end, true)
